classdef tfTuning <tuning
    
    properties
        units = 'Hz';
        calcMethod
        tuningParams
    end
    properties(Transient = true)
        sampleTuning
        sampleRange
    end
    methods
        function s = tfTuning(calcMethod,tuningParams,type)
            if ~exist('type','var')||isempty(type)
                type = 'tfTuning';
            end
            s = s@tuning(type);
            if ischar(calcMethod)
                ok = false;
                switch calcMethod
                    case 'STA'
                        % param needs KC,KS,RC,RS
                        error('not yet');
                    case 'gaussian'
                        if all(ismember(fieldnames(tuningParams),{'optTF','sigmaTF'}))
                            ok = true;
                        end
                end
                if ~ok
                    error('tfTuning:inappropriateInput','calcMethod is wrong or params do not match calcMethod');
                end
                s.calcMethod = calcMethod;
                s.tuningParams = tuningParams;
            else
                error('tfTuning:wrongType','type needs to be a char');
            end
        end
        
        function out = sample(s,stim)
            switch s.calcMethod
                case 'STA'
                    error('not yet');
                case 'gaussian'
                    TF = getTempFreq(stim);
                    out = exp(-(TF-s.tuningParams.optTF)^2/(s.tuningParams.sigmaTF^2));
            end
        end
    end
end